<template>
  <a v-show="url" class="base-attachment" :href="url" :download="'fanyibar'" target="_blank">
    <a-icon class="base-icon" type="inbox" />
      <a-tooltip title="文件大小：未知，文件原始名：未知，上传时间：2020-2-30">
    <span class="attachment-info">文件类型可能为：{{fileType}}，下载所需积分：{{0}}点</span>
      </a-tooltip>
  </a>
</template>

<script>
export default {
  name: 'BaseAttachment',
  props: {
    url: {
      type: String,
    },
    info: Object, // 附件的其他信息，先保留用
  },
  computed: {
    fileType() {
      let index = this.url.lastIndexOf('.')
      console.log(this.url.length-index);
      if(this.url.length-index>7) index=this.url.length-7
      return this.url.substr(index + 1)
    },
  },
}
</script>

<style lang="scss" scoped>
.base-attachment {
  display: inline-block;
  border-radius: 4px;
  box-shadow: 2px 2px 4px 0px #604f4f;
  margin: 15px 5px;
  padding-right: 10px;
  height: 50px;
}
.base-icon {
  font-size: 3rem;
  color: #40a9ff;
}
.attachment-info {
  font-size: 16px;
}
</style>